package com.woniuxy.thred.state;

/**
 * description: BlockedJoin01 <br>
 * date: 2022/2/5 6:31 下午 <br>
 * author: shesaifei <br>
 * version: 1.0 <br>
 */

/**
 * join:合并线程，插队线程
 */
public class BlockedJoin01 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println("lambda!" + i);
            }
        });
        t.start();
        for (int i = 0; i < 100; i++) {
            if (i == 20) {
                t.join();//插队
            }
            System.out.println("main....." + i);
        }
    }
}
